/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmDangKy.java
 *
 * Created on 23-05-2011, 00:36:42
 */
package Presentation;

import RSCall.BaoRSc;
import RSCall.ChiTietBaoRSc;
import RSCall.DiaOcRSc;
import RSCall.DuongRSc;
import RSCall.GiaTienQCBangRSc;
import RSCall.GiaTienQCBaoRSc;
import RSCall.GiaTienQCToBuomRSc;
import RSCall.KhachHangRSc;
import RSCall.LoaiDiaOCRSc;
import RSCall.NoiDungRSc;
import RSCall.PhieuDangKyRSc;
import RSCall.PhuongRSc;
import RSCall.QCBangRSc;
import RSCall.QCBaoRSc;
import RSCall.QuanRSc;
import RSCall.ThamSoRSc;
import RSCall.ThanhPhoRSc;
import RSCall.ToBuomRSc;
import Entities.DIAOC;
import Entities.KHACHHANG;
import Entities.PHIEUDANGKY;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.beans.PropertyVetoException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author Nixforest
 */
public class frmGiaHan extends javax.swing.JInternalFrame{

    /** Creates new form frmDangKy */
    public frmGiaHan(String maDiaOc) {
        MaDiaOc = maDiaOc;
        initComponents();
        // Load một số dữ liệu ban đầu cần thiết
        Creation();
        LoadData();
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        canvas1 = new java.awt.Canvas();
        jPanel3 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        tbxDenNgay = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        chbxToBuom = new javax.swing.JCheckBox();
        chbxQCBao = new javax.swing.JCheckBox();
        chbxQCBang = new javax.swing.JCheckBox();
        pnlToBuom = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        tbxGiaTien_ToBuom = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        tbxSoLuong = new javax.swing.JTextField();
        pnlQCBao = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        tbxVitriQC = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        tbxGiaTien_QCBao = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAreaGhiChu_QCBao = new javax.swing.JTextArea();
        chbxCoHinhAnh = new javax.swing.JCheckBox();
        jLabel25 = new javax.swing.JLabel();
        tbxMauSac = new javax.swing.JTextField();
        tbxKhoIn = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        pnlLoaiBao = new javax.swing.JPanel();
        jLabel36 = new javax.swing.JLabel();
        tbxNgayBatDau = new javax.swing.JTextField();
        pnlQCBang = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        tbxDVT = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        tbxKichCo = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        tbxGiaTien_QCBang = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtAreaMoTa = new javax.swing.JTextArea();
        tbxLoaiBang = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtAreaNoiDungQC = new javax.swing.JTextArea();
        btnGiaHan = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        tbxTuNgay = new javax.swing.JTextField();
        pnlKhachHang = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        tbxHoTen = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        tbxSoDT = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        tbxEmail = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        tbxMaKH = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtAreaDiaChiKH = new javax.swing.JTextArea();
        pnlDiaOc = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        tbxDTDat = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        tbxDTXD = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        tbxHuong = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        tbxViTri_DiaOc = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        tbxMoTa = new javax.swing.JTextField();
        tbxLoaiDiaOc = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        tbxGiaBan = new javax.swing.JTextField();
        jScrollPane5 = new javax.swing.JScrollPane();
        txtAreaDiaChiDiaOc = new javax.swing.JTextArea();

        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        setClosable(true);
        setTitle(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("extend"));
        setMaximumSize(new java.awt.Dimension(999, 680));
        setMinimumSize(new java.awt.Dimension(999, 680));
        setPreferredSize(new java.awt.Dimension(999, 680));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adinfo")));

        jLabel13.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("extendtoday"));

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adtype"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        chbxToBuom.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("handbill"));
        chbxToBuom.setEnabled(false);
        chbxToBuom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chbxToBuomActionPerformed(evt);
            }
        });

        chbxQCBao.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adnewspaper"));
        chbxQCBao.setEnabled(false);
        chbxQCBao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chbxQCBaoActionPerformed(evt);
            }
        });

        chbxQCBang.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adboard"));
        chbxQCBang.setEnabled(false);
        chbxQCBang.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chbxQCBangActionPerformed(evt);
            }
        });

        pnlToBuom.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("handbill")));

        jLabel14.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("quantity"));

        jLabel30.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("cost"));

        tbxGiaTien_ToBuom.setEditable(false);

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("Presentation/vn"); // NOI18N
        jLabel15.setText(bundle.getString("VND")); // NOI18N

        tbxSoLuong.setEditable(false);

        javax.swing.GroupLayout pnlToBuomLayout = new javax.swing.GroupLayout(pnlToBuom);
        pnlToBuom.setLayout(pnlToBuomLayout);
        pnlToBuomLayout.setHorizontalGroup(
            pnlToBuomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlToBuomLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlToBuomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlToBuomLayout.createSequentialGroup()
                        .addComponent(jLabel30)
                        .addGap(18, 18, 18)
                        .addComponent(tbxGiaTien_ToBuom, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15))
                    .addGroup(pnlToBuomLayout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tbxSoLuong, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlToBuomLayout.setVerticalGroup(
            pnlToBuomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlToBuomLayout.createSequentialGroup()
                .addGroup(pnlToBuomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(tbxSoLuong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlToBuomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(tbxGiaTien_ToBuom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlQCBao.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adnewspaper")));

        jLabel16.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("location"));

        tbxVitriQC.setEditable(false);

        jLabel17.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("printsize"));

        jLabel18.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("cost"));

        tbxGiaTien_QCBao.setEditable(false);

        jLabel19.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("note"));

        txtAreaGhiChu_QCBao.setColumns(20);
        txtAreaGhiChu_QCBao.setEditable(false);
        txtAreaGhiChu_QCBao.setLineWrap(true);
        txtAreaGhiChu_QCBao.setRows(5);
        txtAreaGhiChu_QCBao.setWrapStyleWord(true);
        txtAreaGhiChu_QCBao.setAutoscrolls(false);
        jScrollPane1.setViewportView(txtAreaGhiChu_QCBao);

        chbxCoHinhAnh.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("isHinhAnh"));
        chbxCoHinhAnh.setEnabled(false);

        jLabel25.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("color"));

        tbxMauSac.setEditable(false);

        tbxKhoIn.setEditable(false);

        jLabel31.setText(bundle.getString("VND")); // NOI18N

        pnlLoaiBao.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout pnlLoaiBaoLayout = new javax.swing.GroupLayout(pnlLoaiBao);
        pnlLoaiBao.setLayout(pnlLoaiBaoLayout);
        pnlLoaiBaoLayout.setHorizontalGroup(
            pnlLoaiBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 211, Short.MAX_VALUE)
        );
        pnlLoaiBaoLayout.setVerticalGroup(
            pnlLoaiBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 105, Short.MAX_VALUE)
        );

        jLabel36.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("publish day"));

        tbxNgayBatDau.setEditable(false);

        javax.swing.GroupLayout pnlQCBaoLayout = new javax.swing.GroupLayout(pnlQCBao);
        pnlQCBao.setLayout(pnlQCBaoLayout);
        pnlQCBaoLayout.setHorizontalGroup(
            pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlQCBaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlQCBaoLayout.createSequentialGroup()
                        .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlQCBaoLayout.createSequentialGroup()
                                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel19)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(pnlLoaiBao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(chbxCoHinhAnh)))
                            .addGroup(pnlQCBaoLayout.createSequentialGroup()
                                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlQCBaoLayout.createSequentialGroup()
                                        .addComponent(jLabel16)
                                        .addGap(18, 18, 18)
                                        .addComponent(tbxVitriQC, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlQCBaoLayout.createSequentialGroup()
                                        .addComponent(jLabel17)
                                        .addGap(18, 18, 18)
                                        .addComponent(tbxKhoIn)))
                                .addGap(18, 18, 18)
                                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(pnlQCBaoLayout.createSequentialGroup()
                                        .addComponent(jLabel25)
                                        .addGap(18, 18, 18)
                                        .addComponent(tbxMauSac, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                                    .addGroup(pnlQCBaoLayout.createSequentialGroup()
                                        .addComponent(jLabel36)
                                        .addGap(18, 18, 18)
                                        .addComponent(tbxNgayBatDau, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)))))
                        .addContainerGap())
                    .addGroup(pnlQCBaoLayout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tbxGiaTien_QCBao, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel31))))
        );
        pnlQCBaoLayout.setVerticalGroup(
            pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlQCBaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(tbxVitriQC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25)
                    .addComponent(tbxMauSac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(tbxKhoIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel36)
                    .addComponent(tbxNgayBatDau, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(tbxGiaTien_QCBao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel31))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(chbxCoHinhAnh))
                .addGap(11, 11, 11)
                .addGroup(pnlQCBaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane1)
                    .addComponent(pnlLoaiBao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(106, Short.MAX_VALUE))
        );

        pnlQCBang.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adboard")));

        jLabel21.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("board"));

        jLabel22.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("unit"));

        tbxDVT.setEditable(false);

        jLabel27.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("size"));

        tbxKichCo.setEditable(false);

        jLabel28.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("cost"));

        tbxGiaTien_QCBang.setEditable(false);

        jLabel32.setText(bundle.getString("VND")); // NOI18N

        jLabel26.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("describe"));

        txtAreaMoTa.setColumns(20);
        txtAreaMoTa.setEditable(false);
        txtAreaMoTa.setLineWrap(true);
        txtAreaMoTa.setRows(5);
        txtAreaMoTa.setWrapStyleWord(true);
        jScrollPane2.setViewportView(txtAreaMoTa);

        tbxLoaiBang.setEditable(false);

        javax.swing.GroupLayout pnlQCBangLayout = new javax.swing.GroupLayout(pnlQCBang);
        pnlQCBang.setLayout(pnlQCBangLayout);
        pnlQCBangLayout.setHorizontalGroup(
            pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlQCBangLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel27)
                            .addComponent(jLabel28))
                        .addGap(18, 18, 18)
                        .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlQCBangLayout.createSequentialGroup()
                                .addComponent(tbxGiaTien_QCBang, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel32))
                            .addComponent(tbxKichCo, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)))
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addGap(18, 18, 18)
                        .addComponent(tbxDVT, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE))
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tbxLoaiBang, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)))
                .addContainerGap())
        );
        pnlQCBangLayout.setVerticalGroup(
            pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlQCBangLayout.createSequentialGroup()
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(tbxLoaiBang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel26))
                    .addGroup(pnlQCBangLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(15, 15, 15)
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tbxDVT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22))
                .addGap(18, 18, 18)
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(tbxKichCo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(pnlQCBangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel28)
                    .addComponent(tbxGiaTien_QCBang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel32))
                .addContainerGap(75, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chbxQCBao)
                    .addComponent(chbxToBuom)
                    .addComponent(chbxQCBang)
                    .addComponent(pnlQCBao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlToBuom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pnlQCBang, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(pnlToBuom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlQCBang, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(29, 29, 29))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(chbxToBuom)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chbxQCBao)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(chbxQCBang)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlQCBao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel34.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("adcontent"));

        txtAreaNoiDungQC.setColumns(20);
        txtAreaNoiDungQC.setEditable(false);
        txtAreaNoiDungQC.setLineWrap(true);
        txtAreaNoiDungQC.setRows(5);
        txtAreaNoiDungQC.setWrapStyleWord(true);
        txtAreaNoiDungQC.setAutoscrolls(false);
        jScrollPane3.setViewportView(txtAreaNoiDungQC);

        btnGiaHan.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("extend"));
        btnGiaHan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGiaHanActionPerformed(evt);
            }
        });

        jLabel12.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("fromday"));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(14, 14, 14)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel12)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jLabel13)
                                        .addGap(38, 38, 38)
                                        .addComponent(jLabel34))))
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(tbxTuNgay, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(tbxDenNgay, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnGiaHan, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnGiaHan, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
                    .addComponent(jScrollPane3)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(tbxTuNgay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel34)
                            .addComponent(jLabel13))
                        .addGap(15, 15, 15)
                        .addComponent(tbxDenNgay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pnlKhachHang.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("chudiaoc")));
        pnlKhachHang.setMaximumSize(new java.awt.Dimension(256, 248));
        pnlKhachHang.setMinimumSize(new java.awt.Dimension(256, 248));

        jLabel1.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("hoten"));

        tbxHoTen.setEditable(false);

        jLabel2.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("address"));

        jLabel3.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("soDT"));

        tbxSoDT.setEditable(false);
        tbxSoDT.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                tbxSoDTKeyTyped(evt);
            }
        });

        jLabel4.setText(bundle.getString("email")); // NOI18N

        tbxEmail.setEditable(false);

        jLabel33.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("customerid"));

        tbxMaKH.setEditable(false);

        txtAreaDiaChiKH.setColumns(20);
        txtAreaDiaChiKH.setLineWrap(true);
        txtAreaDiaChiKH.setRows(5);
        txtAreaDiaChiKH.setWrapStyleWord(true);
        txtAreaDiaChiKH.setAutoscrolls(false);
        jScrollPane4.setViewportView(txtAreaDiaChiKH);

        javax.swing.GroupLayout pnlKhachHangLayout = new javax.swing.GroupLayout(pnlKhachHang);
        pnlKhachHang.setLayout(pnlKhachHangLayout);
        pnlKhachHangLayout.setHorizontalGroup(
            pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlKhachHangLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlKhachHangLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(18, 18, 18)
                        .addComponent(tbxEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE))
                    .addGroup(pnlKhachHangLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(18, 18, 18)
                        .addComponent(tbxSoDT, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                    .addGroup(pnlKhachHangLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE))
                    .addGroup(pnlKhachHangLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(tbxHoTen, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))
                    .addGroup(pnlKhachHangLayout.createSequentialGroup()
                        .addComponent(jLabel33)
                        .addGap(18, 18, 18)
                        .addComponent(tbxMaKH, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)))
                .addContainerGap())
        );
        pnlKhachHangLayout.setVerticalGroup(
            pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlKhachHangLayout.createSequentialGroup()
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(tbxMaKH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tbxHoTen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(tbxSoDT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlKhachHangLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(tbxEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pnlDiaOc.setBorder(javax.swing.BorderFactory.createTitledBorder(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("thongTinDiaOc")));
        pnlDiaOc.setMaximumSize(new java.awt.Dimension(256, 362));
        pnlDiaOc.setMinimumSize(new java.awt.Dimension(256, 362));

        jLabel5.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("property type"));

        jLabel6.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("address"));

        jLabel7.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("s1"));

        tbxDTDat.setEditable(false);
        tbxDTDat.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                tbxDTDatKeyTyped(evt);
            }
        });

        jLabel8.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("s2"));

        tbxDTXD.setEditable(false);
        tbxDTXD.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                tbxDTXDKeyTyped(evt);
            }
        });

        jLabel9.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("direction"));

        tbxHuong.setEditable(false);

        jLabel10.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("location"));

        tbxViTri_DiaOc.setEditable(false);

        jLabel11.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("describe"));

        tbxMoTa.setEditable(false);

        tbxLoaiDiaOc.setEditable(false);

        jLabel35.setText(java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("cost"));

        tbxGiaBan.setEditable(false);
        tbxGiaBan.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                tbxGiaBanKeyTyped(evt);
            }
        });

        txtAreaDiaChiDiaOc.setColumns(20);
        txtAreaDiaChiDiaOc.setLineWrap(true);
        txtAreaDiaChiDiaOc.setRows(5);
        txtAreaDiaChiDiaOc.setWrapStyleWord(true);
        txtAreaDiaChiDiaOc.setAutoscrolls(false);
        jScrollPane5.setViewportView(txtAreaDiaChiDiaOc);

        javax.swing.GroupLayout pnlDiaOcLayout = new javax.swing.GroupLayout(pnlDiaOc);
        pnlDiaOc.setLayout(pnlDiaOcLayout);
        pnlDiaOcLayout.setHorizontalGroup(
            pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDiaOcLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDiaOcLayout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(tbxDTDat, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))
                    .addGroup(pnlDiaOcLayout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))
                    .addGroup(pnlDiaOcLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(tbxLoaiDiaOc, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))
                    .addGroup(pnlDiaOcLayout.createSequentialGroup()
                        .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel35)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tbxMoTa, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                            .addComponent(tbxGiaBan, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                            .addComponent(tbxViTri_DiaOc, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                            .addComponent(tbxHuong, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                            .addComponent(tbxDTXD, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))))
                .addContainerGap())
        );
        pnlDiaOcLayout.setVerticalGroup(
            pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDiaOcLayout.createSequentialGroup()
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(tbxLoaiDiaOc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(tbxDTDat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(tbxDTXD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(tbxHuong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(tbxViTri_DiaOc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel35)
                    .addComponent(tbxGiaBan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlDiaOcLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(tbxMoTa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlDiaOc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlKhachHang, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(canvas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(canvas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(14, 14, 14))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addComponent(pnlKhachHang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11)
                        .addComponent(pnlDiaOc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Chọn hình thức quảng cáo Tờ Bướm
    private void chbxToBuomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chbxToBuomActionPerformed
        LoadStateHinhThucQC();
    }//GEN-LAST:event_chbxToBuomActionPerformed

    // Chọn hình thức quảng cáo Báo
    private void chbxQCBaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chbxQCBaoActionPerformed
        LoadStateHinhThucQC();
    }//GEN-LAST:event_chbxQCBaoActionPerformed

    // Chọn hình thức quảng cáo Bảng
    private void chbxQCBangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chbxQCBangActionPerformed
        LoadStateHinhThucQC();
    }//GEN-LAST:event_chbxQCBangActionPerformed

    // Kiểm tra xem khách hàng cũ hay mới
    // Xử lý đăng ký
    private void btnGiaHanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGiaHanActionPerformed
        // Kiểm tra các điều kiện ràng buộc
        if (CheckPhieuDangKy()) {
            // Xử lý Tạo mới Phiếu đăng ký
            Date tuNgay = Date.valueOf(tbxTuNgay.getText().trim());
            Date denNgay = Date.valueOf(tbxDenNgay.getText().trim());
            Float soTien = Float.MIN_VALUE;
            if (chbxToBuom.isSelected()) {
                soTien += Float.parseFloat(tbxGiaTien_ToBuom.getText());
            }
            if (chbxQCBao.isSelected()) {
                soTien += Float.parseFloat(tbxGiaTien_QCBao.getText()) * listBao.size();
            }
            if (chbxQCBang.isSelected()) {
                soTien += Float.parseFloat(tbxGiaTien_QCBang.getText());
            }
            Date thoiGianHenChupAnh = Date.valueOf(phieuDangKy.getThoiGianHenChupAnh().toString());
            try{
                float soTienPhaiTra = dbThamSo.GetThamSoByTen("TiLeTienTraSoVoiLanDauTien").getGiaTri()*soTien/100;
                long d = (denNgay.getTime() - tuNgay.getTime())/(24*3600*1000);
                soTien += (d+1)*3000;
                MaPhieuDK = dbPhieuDangKy.Insert(MaDiaOc, tuNgay, denNgay, soTienPhaiTra, thoiGianHenChupAnh, MaKH);
            }catch(Exception ex){
                JOptionPane.showMessageDialog(this, ex.toString());
            }
            
            // Xử lý đăng ký các Hình thức quảng cáo
            if (chbxToBuom.isSelected()) {                            // Tạo mới Tờ bướm
                String maGiaTien = MaGiaTien_ToBuom;
                        
                try {
                    dbToBuom.Insert(MaND, MaPhieuDK, maGiaTien);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this, ex.toString());
                }
            }
            if (chbxQCBao.isSelected()) {                             // Tạo mới Quảng cáo Báo
                Date ngayBatDauPhatHanh = Date.valueOf(tbxTuNgay.getText().trim());
                Boolean coHinhAnh = chbxCoHinhAnh.isSelected();
                String maGiaTien = MaGiaTien_QC_Bao;
                try {
                    MaQCBao = dbQCBao.Insert(ngayBatDauPhatHanh, coHinhAnh, MaND, MaPhieuDK, maGiaTien);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this, ex.toString());
                }
                
                // Tạo các Chi tiết Báo
                for(String s : listBao){
                    String maBao = s;
                    try {
                        dbChiTietBao.Insert(MaQCBao, maBao);
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(this, ex.toString());
                    }
                }
            }
            if (chbxQCBang.isSelected()) {                            // Tạo mới Quảng cáo Bảng
                String maGiaTien = MaGiaTien_QC_Bang;
                try {
                    dbQCBang.Insert(MaND, MaPhieuDK, maGiaTien);
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this, ex.toString());
                }
            }
            
            // Sửa phiếu đăng ký đã thành công 
            JOptionPane.showMessageDialog(this, java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("extendsuccess"));
        }
        else JOptionPane.showMessageDialog(this, java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("extendfail"));
    }//GEN-LAST:event_btnGiaHanActionPerformed

    private void tbxSoDTKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbxSoDTKeyTyped
        Utilities.Utilities.tbxKeyTyped(evt);
}//GEN-LAST:event_tbxSoDTKeyTyped

    private void tbxDTDatKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbxDTDatKeyTyped
        Utilities.Utilities.tbxKeyTyped(evt);
}//GEN-LAST:event_tbxDTDatKeyTyped

    private void tbxDTXDKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbxDTXDKeyTyped
        Utilities.Utilities.tbxKeyTyped(evt);
}//GEN-LAST:event_tbxDTXDKeyTyped

    private void tbxGiaBanKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbxGiaBanKeyTyped
        Utilities.Utilities.tbxKeyTyped(evt);
}//GEN-LAST:event_tbxGiaBanKeyTyped

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnGiaHan;
    private java.awt.Canvas canvas1;
    private javax.swing.JCheckBox chbxCoHinhAnh;
    private javax.swing.JCheckBox chbxQCBang;
    private javax.swing.JCheckBox chbxQCBao;
    private javax.swing.JCheckBox chbxToBuom;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JPanel pnlDiaOc;
    private javax.swing.JPanel pnlKhachHang;
    private javax.swing.JPanel pnlLoaiBao;
    private javax.swing.JPanel pnlQCBang;
    private javax.swing.JPanel pnlQCBao;
    private javax.swing.JPanel pnlToBuom;
    private javax.swing.JTextField tbxDTDat;
    private javax.swing.JTextField tbxDTXD;
    private javax.swing.JTextField tbxDVT;
    private javax.swing.JTextField tbxDenNgay;
    private javax.swing.JTextField tbxEmail;
    private javax.swing.JTextField tbxGiaBan;
    private javax.swing.JTextField tbxGiaTien_QCBang;
    private javax.swing.JTextField tbxGiaTien_QCBao;
    private javax.swing.JTextField tbxGiaTien_ToBuom;
    private javax.swing.JTextField tbxHoTen;
    private javax.swing.JTextField tbxHuong;
    private javax.swing.JTextField tbxKhoIn;
    private javax.swing.JTextField tbxKichCo;
    private javax.swing.JTextField tbxLoaiBang;
    private javax.swing.JTextField tbxLoaiDiaOc;
    private javax.swing.JTextField tbxMaKH;
    private javax.swing.JTextField tbxMauSac;
    private javax.swing.JTextField tbxMoTa;
    private javax.swing.JTextField tbxNgayBatDau;
    private javax.swing.JTextField tbxSoDT;
    private javax.swing.JTextField tbxSoLuong;
    private javax.swing.JTextField tbxTuNgay;
    private javax.swing.JTextField tbxViTri_DiaOc;
    private javax.swing.JTextField tbxVitriQC;
    private javax.swing.JTextArea txtAreaDiaChiDiaOc;
    private javax.swing.JTextArea txtAreaDiaChiKH;
    private javax.swing.JTextArea txtAreaGhiChu_QCBao;
    private javax.swing.JTextArea txtAreaMoTa;
    private javax.swing.JTextArea txtAreaNoiDungQC;
    // End of variables declaration//GEN-END:variables
    
    private String MaKH;
    private String MaDiaOc;
    private String MaND;
    private String MaPhieuDK;
    private String MaGiaTien_ToBuom;
    private String MaGiaTien_QC_Bao;
    private String MaGiaTien_QC_Bang;
    private String MaQCBao;
    
    // Các Table gốc
    private GiaTienQCToBuomRSc dbGiaToBuom;
    private BaoRSc dbLoaiBao;
    private RSCall.GiaTienQCBaoRSc dbGiaQCBao;
    private RSCall.GiaTienQCBangRSc dbGiaQCBang;
    private LoaiDiaOCRSc dbLoaiDiaOc;
    private RSCall.ThanhPhoRSc dbThanhPho;
    private RSCall.QuanRSc dbQuan;
    private RSCall.PhuongRSc dbPhuong;
    private RSCall.DuongRSc dbDuong;

    // Các table cần thêm mới
    private RSCall.KhachHangRSc dbKhachHang;
    private RSCall.DiaOcRSc dbDiaOc;
    private RSCall.NoiDungRSc dbNoiDungQC;
    private RSCall.PhieuDangKyRSc dbPhieuDangKy;
    private RSCall.ToBuomRSc dbToBuom;
    private RSCall.QCBaoRSc dbQCBao;
    private RSCall.ChiTietBaoRSc dbChiTietBao;
    private RSCall.QCBangRSc dbQCBang;
    private RSCall.ThamSoRSc dbThamSo;

    private Entities.PHIEUDANGKY phieuDangKy;
             
    private ArrayList<String> listBao;                        // Quản lý các Loại báo
     
    private void Creation(){
        try {
            dbGiaToBuom = new GiaTienQCToBuomRSc();
            dbLoaiBao = new BaoRSc();
            dbGiaQCBao = new GiaTienQCBaoRSc();
            dbGiaQCBang = new GiaTienQCBangRSc();
            dbKhachHang = new KhachHangRSc();
            dbDiaOc = new DiaOcRSc();
            dbNoiDungQC = new NoiDungRSc();
            dbPhieuDangKy = new PhieuDangKyRSc();
            dbToBuom = new ToBuomRSc();
            dbQCBao = new QCBaoRSc();
            dbChiTietBao = new ChiTietBaoRSc();
            dbQCBang = new QCBangRSc();
            dbThanhPho = new ThanhPhoRSc();
            dbQuan = new QuanRSc();
            dbPhuong = new PhuongRSc();
            dbDuong = new DuongRSc();
            dbThamSo = new ThamSoRSc();
            dbLoaiDiaOc = new LoaiDiaOCRSc();
            phieuDangKy = new PHIEUDANGKY();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(rootPane, ex.toString());
            Logger.getLogger(frmPhieuDangKy.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
      
    // Load dữ liệu cho form
    private void LoadData(){
        try {
            phieuDangKy = dbPhieuDangKy.GetPhieuDKByMaDiaOc(MaDiaOc);
            MaPhieuDK = phieuDangKy.getMaPhieuDangKy();
            // Tạo xử lý cho Panel thông tin khách hàng
            KHACHHANG k = new KHACHHANG();
            k = dbKhachHang.GetRowByID(phieuDangKy.getMaKH());
            MaKH = k.getMaKH();
            tbxMaKH.setText(k.getMaKH());
            tbxHoTen.setText(k.getHoTen().trim());
            String tenThanhPho = dbThanhPho.GetRowByID(k.getDiaChiKH().getMaThanhPho()).getTenThanhPho().trim();
            String tenQuan = dbQuan.GetRowByID(k.getDiaChiKH().getMaQuan()).getTenQuan().trim();
            String tenPhuong = dbPhuong.GetRowByID(k.getDiaChiKH().getMaPhuong()).getTenPhuong().trim();
            String tenDuong = dbDuong.GetRowByID(k.getDiaChiKH().getMaDuong()).getTenDuong().trim();
            String diaChiCT = k.getDiaChiKH().getDiaChiCT().trim();
            txtAreaDiaChiKH.setText(diaChiCT + " " + tenDuong + " " + tenPhuong + " " + tenQuan + " " + tenThanhPho);
            
            
            tbxSoDT.setText(k.getSoDT().trim());
            tbxEmail.setText(k.getEmail().trim());
            
            // Tạo dữ liệu cho Panel Địa ốc
            //frmMain.setEnabledForAll(pnlDiaOc, false);
            DIAOC diaOc = new DIAOC();
            diaOc = dbDiaOc.GetRowByID(MaDiaOc);
            tbxLoaiDiaOc.setText(dbLoaiDiaOc.GetNameByID(diaOc.getMaLoaiDiaOc()).trim());
            tenThanhPho = dbThanhPho.GetRowByID(diaOc.getDiaChiDiaOc().getMaThanhPho()).getTenThanhPho().trim();
            tenQuan = dbQuan.GetRowByID(diaOc.getDiaChiDiaOc().getMaQuan()).getTenQuan().trim();
            tenPhuong = dbPhuong.GetRowByID(diaOc.getDiaChiDiaOc().getMaPhuong()).getTenPhuong().trim();
            tenDuong = dbDuong.GetRowByID(diaOc.getDiaChiDiaOc().getMaDuong()).getTenDuong().trim();
            diaChiCT = diaOc.getDiaChiDiaOc().getDiaChiCT().trim();
            txtAreaDiaChiDiaOc.setText(diaChiCT + " " + tenDuong + " " + tenPhuong + " " + tenQuan + " " + tenThanhPho);
            tbxDTDat.setText(diaOc.getDienTichDat().toString().trim());
            tbxDTXD.setText(diaOc.getDienTichXayDung().toString().trim());
            tbxHuong.setText(diaOc.getHuong().trim());
            tbxViTri_DiaOc.setText(diaOc.getViTri().trim());
            tbxGiaBan.setText(diaOc.getGiaBan().toString());
            tbxMoTa.setText(diaOc.getMoTa());

            // Thông tin quảng cáo
            Calendar cal = Calendar.getInstance();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date nowTime = Date.valueOf(sdf.format(cal.getTime()));
            
            tbxTuNgay.setText(nowTime.toString());
            tbxDenNgay.setText(nowTime.toString());
            
            MaND = dbDiaOc.GetMaND_From_MaDiaOc(MaDiaOc);
            txtAreaNoiDungQC.setText(dbNoiDungQC.GetRowByID(MaND).getThongTinDiaOc().trim());
            
            // Hình thức quảng cáo
            chbxToBuom.setSelected(dbToBuom.IsMaPhieuDK_ToBuomExist(MaPhieuDK));
            chbxQCBang.setSelected(dbQCBang.IsMaPhieuDK_BangExist(MaPhieuDK));
            chbxQCBao.setSelected(dbQCBao.IsMaPhieuDK_BaoExist(MaPhieuDK));
            if (chbxToBuom.isSelected()) {
                Entities.TOBUOM t = dbToBuom.GetToBuomByMaPhieuDK(MaPhieuDK);   
                Entities.GIATIEN_TOBUOM q = dbGiaToBuom.GetRowByID(t.getMaGiaTien());
                tbxSoLuong.setText(Integer.toString(q.getSoLuong()));
                tbxGiaTien_ToBuom.setText(Float.toString(q.getGiaTien()));
                MaGiaTien_ToBuom = t.getMaGiaTien();
            }
            
            // Tạo dữ liệu cho trường Loại báo
            if (chbxQCBao.isSelected()) {
                Entities.QC_BAO b = dbQCBao.GetQCBaoByMaPhieuDK(MaPhieuDK);
                MaGiaTien_QC_Bao  = b.getMaGiaTien();
                Entities.GIATIEN_QC_BAO q = dbGiaQCBao.GetRowByID(b.getMaGiaTien());
                tbxVitriQC.setText(q.getViTri());
                tbxMauSac.setText(q.getMauSac());
                tbxKhoIn.setText(q.getKhoIn());
                tbxNgayBatDau.setText(b.getNgayBatDauPhatHanh().toString());
                tbxGiaTien_QCBao.setText(q.getGiaTien().toString());
                chbxCoHinhAnh.setSelected(b.getCoHinhAnh());
                txtAreaGhiChu_QCBao.setText(q.getGhiChu()); 
                listBao = dbChiTietBao.GetMaBaoByMaQCBao(b.getMaQCBao());
                // Tạo dữ liệu cho mục chọn các loại báo
                pnlLoaiBao.setLayout(new GridLayout(dbLoaiBao.mainList.size(), 1));
                pnlLoaiBao.setPreferredSize(new Dimension(200, 130));
                pnlLoaiBao.setMinimumSize(pnlLoaiBao.getPreferredSize());
                pnlLoaiBao.setMaximumSize(pnlLoaiBao.getPreferredSize());
                for(String maBao : listBao){
                    JCheckBox c = new JCheckBox(dbLoaiBao.GetRowByID(maBao).getTenBao());
                    c.setSelected(true);
                    c.setEnabled(false);
                    pnlLoaiBao.add(c);
                }
            }
            
                
            
            // Tạo dữ liệu cho panel Quảng cáo Bảng
            if (chbxQCBang.isSelected()) {
                Entities.QC_BANG b = dbQCBang.GetQCBangByMaPhieuDK(MaPhieuDK);
                MaGiaTien_QC_Bang = b.getMaGiaTien();
                Entities.GIATIEN_QC_BANG q = dbGiaQCBang.GetRowByID(b.getMaGiaTien());
                tbxLoaiBang.setText(dbGiaQCBang.GetLoaiBang(q.getMaLoaiBang()));
                txtAreaMoTa.setText(q.getMoTa());
                tbxKichCo.setText(q.getKichCo().toString());
                tbxDVT.setText(q.getDVT());
                tbxGiaTien_QCBang.setText(q.getGiaTien().toString());
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(rootPane, ex.toString());
            return;
        }
        LoadStateHinhThucQC();
    }
    
    // Tạo trạng thái ban đầu cho mỗi hình thức quảng cáo
    private void LoadStateHinhThucQC(){
        Utilities.Utilities.setEnabledForAll(pnlToBuom, chbxToBuom.isSelected());
        Utilities.Utilities.setEnabledForAll(pnlQCBao, chbxQCBao.isSelected());
        Utilities.Utilities.setEnabledForAll(pnlQCBang, chbxQCBang.isSelected());
    }
    
    // Kiểm tra các dữ liệu cần thiết để tạo mới phiếu đăng ký
    private boolean CheckPhieuDangKy(){
        String tuNgay = tbxTuNgay.getText();
        String denNgay = tbxDenNgay.getText();
        String thoiGianHenChupAnh = phieuDangKy.getThoiGianHenChupAnh().toString();
        if (tuNgay.trim().isEmpty()) {
            JOptionPane.showMessageDialog(this,
                java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("mustenterfromday"));
        }else if(denNgay.trim().isEmpty()){
            JOptionPane.showMessageDialog(this,
                java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("mustentertoday"));
        }else if(thoiGianHenChupAnh.trim().isEmpty()){
            JOptionPane.showMessageDialog(this,
                java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("mustenterngayhen"));
        }else{
            try{
                java.sql.Date d1 = java.sql.Date.valueOf(tuNgay.trim());
                java.sql.Date d2 = java.sql.Date.valueOf(denNgay.trim());
                java.sql.Date d3 = java.sql.Date.valueOf(thoiGianHenChupAnh.trim());
                if (d2.compareTo(d1) != -1) {
                    return true;
                }else JOptionPane.showMessageDialog(this,
                java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("validdate"));
            }catch(IllegalArgumentException e){
                JOptionPane.showMessageDialog(this,
                java.util.ResourceBundle.getBundle("Presentation/" + frmMain.resource).getString("dateform"));
            }
        }
        return false;
    }
}
